#导包
import pymysql

#创建数据库链接
conn = pymysql.connect(host="192.168.40.141", user="root", password="123456", database="litemall", port=3306)

#创建游标
cursor = conn.cursor()

#执行sql
cursor.execute("select id, name from litemall_goods")
result = cursor.fetchall()
print("result:", result)

#关闭游标
cursor.close()

#关闭连接
conn.close()
